<%--
  Created by IntelliJ IDEA.
  User: agen
  Date: 2019/12/29
  Time: 15:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>Hello World</title>
</head>
<body>
<h1>Hello World From Struts2</h1>

<%--Actions是Struts2框架的核心,每个URL映射到特定的action--%>
<form action="hello">
    <label for="name">Please enter your name</label><br/>
    <input type="text" name="name" id="name" placeholder="输入error跳转到error.jsp页面"/>
    <input type="submit" value="Say Hello"/>
</form>

<form action="one">
    <input type="submit" value="直接跳转到one.jsp"/>
</form>

<%--拦截器+--%>
<%--拦截器在概念上与servlet过滤器或JDK代理类相同。拦截器允许横切功能，把action以及框架分开实现。--%>
<form action="interceptor">
  <label for="name">Please enter your name</label><br/>
  <input type="text" name="name" />
  <input type="submit" value="拦截器"/>
</form>

<%--结果类型Result：Redirect Action示例--%>
<form action="redirect">
  <input type="submit" value="结果类型：Redirect Action示例"/>
</form>

<%--验证框架--%>
<%--Struts的核心中的验证框架，可在执行action方法之前，帮助应用程序运行规则执行验证--%>
<div>验证框架</div>
<s:form action="empinfo" method="post">
  <s:textfield name="name" label="Name" size="20" />
  <s:textfield name="age" label="Age" size="20" />
  <s:submit name="submit" label="Submit" align="center" />
</s:form>

<%--Struts2 应用程序可以使用Java5注解来替代XML和Java属性的配置--%>
<div>Struts2注解</div>
<s:form action="empinfotwo" method="post">
    <s:textfield name="name" label="Name" size="20" />
    <s:textfield name="age" label="Age" size="20" />
    <s:submit name="submit" label="Submit" align="center" />
</s:form>
</body>
